using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using com.eforceglobal.crux.DTOs;
using com.eforceglobal.crux.BusinessObjects;
using com.eforceglobal.crux.BusinessObjects.DatabaseQueries;

namespace com.eforceglobal.crux.BusinessFacades
{
    public class PrivilageFacade
    {
        public List<PrivilageInformation> GetPrivilages()
        {
            return GetAllPrivilagesEnumerableList().ToList();
        }

        public IEnumerable<PrivilageInformation> GetAllPrivilagesEnumerableList()
        {
            Queries query = new Queries();
            IEnumerable<PrivilageInformation> privilages =
                from privilagesList in query.GetAllPrivilages()
                select ClassConverter.CopyPrivilageToPrivilageInformation(privilagesList);
            return privilages;
        }

        public List<PrivilageInformation> GetPrivilagesForRole(int RoleID)
        {
            Queries queries = new Queries();
            IEnumerable<PrivilageInformation> privilages = from privilageList in queries.GetPrivilagesForRole(RoleID)
                                                           select ClassConverter.CopyPrivilageToPrivilageInformation(privilageList);
            return privilages.ToList();
        }

        
    }
}
